using System.Collections.Generic;

namespace OracleInternal.SqlAndPlsqlParser.LocalParsing.Ansi
{
	internal abstract class OracleLpBaseAnsiJoinClauseWithCondition : OracleLpBaseAnsiJoinClause
	{
		protected OracleLpTableReferenceAnsi m_vTableReference;

		protected OracleLpJoinCondition m_vCondition;

		internal override OracleLpJoinClauseConditionalType ConditionalType => OracleLpJoinClauseConditionalType.OnUsingCondition;

		public override List<OracleLpColumnDescriptor> ColumnDescriptors => m_vTableReference.ColumnDescriptors;

		public OracleLpTableReferenceAnsi TableReference
		{
			get
			{
				return m_vTableReference;
			}
			set
			{
				m_vTableReference = value;
				if (m_vTableReference != null)
				{
					m_vTableReference.Parent = this;
				}
			}
		}

		public OracleLpJoinCondition Condition
		{
			get
			{
				return m_vCondition;
			}
			set
			{
				m_vCondition = value;
			}
		}

		internal override List<OracleLpTablePrimary> TablePrimaryList
		{
			get
			{
				if (m_vTablePrimaryList == null)
				{
					m_vTablePrimaryList = new List<OracleLpTablePrimary>();
					m_vTablePrimaryList.AddRange(m_vTableReference.TablePrimaryList);
				}
				return m_vTablePrimaryList;
			}
		}

		public OracleLpBaseAnsiJoinClauseWithCondition(OracleLpFromListTerm ft)
			: base(ft)
		{
		}

		public override void RetrieveNamedObjectReferences(OracleLpStatement statement)
		{
			m_vTableReference.RetrieveNamedObjectReferences(statement);
		}
	}
}
